﻿#pragma once

#include "SourceCode/Renderer/FrameBuffer.h"

namespace Hazal
{
	class COpenGLFrameBuffer : public CFrameBuffer
	{
	public:
		COpenGLFrameBuffer(const SFrameBufferSpecification& spec);

		virtual ~COpenGLFrameBuffer();

	public:
		SFrameBufferSpecification& GetSpecification() override;

		const SFrameBufferSpecification& GetSpecification() const override;

		uint32_t GetColorAttachmentRendererID(int32_t nIndex = 0) const override;

		int ReadPixel(uint32_t unAttachmentIndex, int x, int y) override;

		void ClearAttachment(uint32_t unAttachmentIndex, int nValue) const override;

		void Bind() override;

		void Unbind() override;

		void Resize(uint32_t unWidth, uint32_t unHeight) override;

	public:
		void Invalidate();

	private:
		uint32_t m_unRendererID;
		std::vector<uint32_t> m_vecColorAttachments;
		uint32_t m_unDepthAttachment = 0;

		SFrameBufferSpecification m_specification;
		std::vector<SFramebufferTextureSpecification> m_vecColorAttachmentSpecs;
		SFramebufferTextureSpecification m_DepthAttachmentSpec = EFramebufferTextureFormat::None;


	};
}
